<?php
/**
* Wards Edit
* @author: trungdt
* For HuyBDS Project
*/

if (!defined("EXPONENT")) exit("");
	$listing = null;
	if (isset($_GET['id'])) {
		$listing = $db->selectObject("provinces_wards","id=".intval($_GET['id']));
	}
	
    $pid=-1;
    if (isset($_REQUEST['pid']))
    {
        $pid=intval($_REQUEST['pid']);
    }
    $province=$db->selectObject("provinces","id=".$pid);
    if (exponent_users_isAdmin() && exponent_users_isLoggedIn() && $pid){
		
        
        
        $form = rsmanage_item::ward_form($listing);
		//$form->location($loc);
        $form->meta("pid",$province->id);
		$form->meta("action","ward_save");
        // because we dont set $loc, we must set module name
        $form->meta("module","rsmanagemodule");   
				
		$template = new template("rsmanagemodule","_wards_form_edit",$loc);
        $template->assign("is_edit",(isset($listing->id) ? 1 : 0));
		$template->assign("province",$province);
		$template->assign("form_html",$form->toHTML());
		$template->output();
	} else {
		echo SITE_403_HTML;
	}

?>
